#ifndef   __HAL_INT__
#define   __HAL_INT__

#include  "TypeDef.h"
#include  "hal_avr.h"

#ifdef __cplusplus
extern "C" {
#endif

//----------------------------------------------------------------------------------
// Type define
//----------------------------------------------------------------------------------  
typedef   INT8U  istate_t;
//----------------------------------------------------------------------------------
// MACROS
//----------------------------------------------------------------------------------

#ifdef __IAR_SYSTEMS_ICC__

// Use the macros below to reduce function call overhead for common
// global interrupt control functions

#define HAL_INT_ON(x)      st( __enable_interrupt();)
#define HAL_INT_OFF(x)     st( __disable_interrupt();)
#define HAL_INT_LOCK(x)    st( (x) = __get_interrupt_state(); __disable_interrupt();)
#define HAL_INT_UNLOCK(x)  st( __set_interrupt_state(x);)

#else
#error "Unsupported compiler"
#endif

//----------------------------------------------------------------------------------
// Function declarations
//----------------------------------------------------------------------------------

void   halIntOn(void);
void   halIntOff(void);
INT8U  halIntLock(void);
void   halIntUnlock(INT8U key);


#ifdef  __cplusplus
}
#endif

/**********************************************************************************/
#endif

